// Header File
// Created 11/19/2007; 5:37:20 PM

#ifndef __CIVILIZATION_H__
#define __CIVILIZATION_H__

#include "Globals.h"
#include "BitArray.h"
#include "City.h"
#include "Unit.h"
#include "Technology.h"

//defines the max number of civs
#define CIV_NUMBER 4
extern char civNumb;

// Interaction Structure
typedef struct
{
	char *isKnown;
	char *relation;
} Interaction;

// Civilization Structure
typedef struct
{
	// Index for type
	char type;
	
	// Other
	char currentName; // Index
	unsigned int gold;
	
	// Taxes
	char luxuryPercent;
	char sciencePercent;
	
	// Technology
	BitArray techs[TECH_NUMBER/8+1];
	char currentTechResearch;
	int researchAmount;
	
	// Map Fog
	BitArray *fog;
	
	// Interactions between civilizations
	Interaction inter;
	
	// Units
	_Unit unit[UNIT_NUMBER];
	char unitSize;
	
	// Cities
	City city[CITY_NUMBER];
	char citySize;
} Civ;

// Main civilization array
Civ *civilization;

// AI Types
#define MILITARISTIC  0
#define EXPANSIONIST  1
#define PERFECTIONIST 2
#define ISOLATIONIST  3

// AI structure
typedef struct
{
	char type;
	char autoSettlers;
	char *attitude;
} AI;

// Array of AI civilizations
AI *aiCivs;

////////////////////////////
// Civ Methods /////////////
////////////////////////////
bool AllocateCivData(int number);
void FreeCivData();

void NewCiv(char index);
int CalculatePopulation();
int CalculateIncome(char civ);
int CalculateScience(char civ);
void RecalculateCities(char civ);
void UpdateUnits(char civ);
void UpdateCities(char civ);
void RemoveFog(char civ, int x, int y);
void AdvisorMenu();
void BuyEmbassyWindow(char civ);
int GetAvailableUnits(char civ, char unitI[11]);
int GetAvailableBuildings(char civ, char city, char buildingI[11]);
void TradeWindow(char civ);

#endif
